// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';

/** 获取订单列表 */
export async function getOrderList(params: API.Order.OrderParams) {
  return request('/api/order', {
    method: 'GET',
    params,
  });
}

/** 获取订单下拉列表 */
export async function getOrderSelect() {
  return request('/api/order/select', {
    method: 'GET',
  });
}

export async function addOrderList(data: API.Order.OrderParams) {
  return request('/api/order/add', {
    method: 'POST',
    data,
  });
}

export async function updateOrderList(data: API.Order.OrderData) {
  return request('/api/order/update', {
    method: 'POST',
    data,
  });
}

export async function deleteOrderList(id: string) {
  return request('/api/order/delete', {
    method: 'DELETE',
    params: { id },
  });
}

/** 订单标记 */
export async function marksOrder(params: { id: number; mark: string }) {
  return request('/api/order/mark', {
    method: 'GET',
    params,
  });
}

/** 订单支付 */
export async function payOrder(params: { id: number; money_pay: number }) {
  return request('/api/order/pay', {
    method: 'GET',
    params,
  });
}

// -------------------------------- 采购订单 -------------------
// 查询列表
export async function purchaseOrderList(params: API.PurchaseOrder.params) {
  return request('/api/purchaseOrder', {
    method: 'GET',
    params,
  });
}
// 新增
export async function purchaseAddOrder(data: API.PurchaseOrder.data) {
  return request('/api/purchaseOrder/add', {
    method: 'POST',
    data,
  });
}
// 修改
export async function purchaseUpdateOrder(data: API.PurchaseOrder.data) {
  return request('/api/purchaseOrder/update', {
    method: 'POST',
    data,
  });
}
// 删除
export async function purchaseDeleteOrder(id: number) {
  return request('/api/purchaseOrder/delete', {
    method: 'DELETE',
    params: { id },
  });
}

// 已支付金额
export async function purchaseOrderPay(params: { id: number; moenyPay: number }) {
  return request('/api/purchaseOrder/pay', {
    method: 'GET',
    params,
  });
}

/** 采购订单标记 */
export async function marksPurchaseOrder(params: { id: number; mark: string }) {
  return request('/api/purchaseOrder/mark', {
    method: 'GET',
    params,
  });
}

/** 采购订单付款 */
export async function payPurchaseOrder(params: { id: number; money_pay: number }) {
  return request('/api/purchaseOrder/pay', {
    method: 'GET',
    params,
  });
}

/** 销售提成 */
export async function mySaleMoney(params: { id: number }) {
  return request('/api/purchaseOrder/saleMoney', {
    method: 'GET',
    params,
  });
}

/** 所有销售提成 */
export async function allSaleMoney(params: any) {
  return request('/api/analysis/saleMoneyAll', {
    method: 'GET',
    params,
  });
}
